package tralala.server;

import java.rmi.*;

import tralala.server.remote.ITralalaManager;
import tralala.server.remote.TralalaManager;

public class TralalaManagerServer {
	
	public static void main(String[] args) {
	if (args.length != 3) {
		System.exit(0);
	}

	if (System.getSecurityManager() == null) {
		System.setSecurityManager(new RMISecurityManager());
	}

	String name = "//" + args[0] + ":" + args[1] + "/" + args[2];
	System.out.println(name);
	try {
		TralalaService TralalaData = new TralalaService();
		ITralalaManager adminService = new TralalaManager(TralalaData);			
		Naming.rebind(name, adminService);
		System.out.println("* Tralala Servidor de Música '" + name + "' activo y funciona...");
		
	} catch (Exception e) {
		System.err.println("$ Excepción TralalaServer: " + e.getMessage());
		e.printStackTrace();
	}
	}
}
